package com.diamond.smart.data.config;

import lombok.Data;
import org.eclipse.paho.client.mqttv3.MqttClient;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;

@Data
@Configuration
//mqtt.enable与havingValue的值进行对比，相同则配置类生效
@ConditionalOnProperty(value = "mqtt.enable", havingValue = "true")
//与配置文件中mqtt.相同名字的配置绑定
@ConfigurationProperties(prefix = "mqtt")
public class MqttClientConfig {

    private String url;

    private String clientId;

    private String username;

    private String password;

    private int timeout;

    private int keepalive;

    private MqttClient client;

}
